using System;
using System.ServiceModel;
using System.ServiceModel.Description;
using HengTong.Kingdee;
using Microsoft.Extensions.Configuration;

namespace HengTong.Kingdee.WSExportMaterialFacadeSrvProxyService
{
    /// <summary>
    /// Partial class扩展，用于从配置文件读取服务地址
    /// 这个文件不会被自动生成工具覆盖
    /// 
    /// 使用说明：
    /// 1. 将 {YourServiceNamespace} 替换为实际的命名空间（例如：WSExportCustomerFacadeSrvProxyService）
    /// 2. 将 {YourServiceClient} 替换为实际的客户端类名（例如：WSExportCustomerFacadeSrvProxyClient）
    /// 3. 将 ServicePath 修改为实际的服务路径（例如：/ormrpc/services/WSExportCustomerFacade）
    /// </summary>
    public partial class WSExportMaterialFacadeSrvProxyClient
    {
    // TODO: 修改为实际的服务路径
    private const string ServicePath = "/ormrpc/services/WSExportMaterialFacade";

    /// <summary>
    /// 从配置文件创建客户端实例
    /// </summary>
    public static WSExportMaterialFacadeSrvProxyClient CreateFromConfiguration(IConfiguration configuration = null)
    {
        var endpoint = KingdeeEASClientHelper.CreateEndpointAddress(ServicePath, configuration);
        var binding = KingdeeEASClientHelper.CreateStandardBinding();

        return new WSExportMaterialFacadeSrvProxyClient(binding, endpoint);
    }

    /// <summary>
    /// ConfigureEndpoint partial method implementation
    /// 使用统一的配置方法
    /// </summary>
    static partial void ConfigureEndpoint(ServiceEndpoint serviceEndpoint, ClientCredentials clientCredentials)
    {
        KingdeeEASClientHelper.ConfigureEndpoint(serviceEndpoint, clientCredentials);
    }
}
}